package 高级;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;

//2:计算当前时间距“世界末日”已经过去了多少天（2012-12-21）
public class Zuoye04223 {
    public static void main(String[] args) throws ParseException {
        String a = "2012-12-21";
        SimpleDateFormat b = new SimpleDateFormat("yyyy-MM-dd");
        Date c=b.parse(a);
        String format =b.format(c);
        System.out.println("世界末日是" + format);
        LocalDate date = LocalDate.now();
        System.out.println("当前日期" + date);
        long datetime = c.getTime();
        long todaytime = new Date().getTime();
        long diff=todaytime-datetime;
        System.out.println("距世界末日已经过去了"+diff/1000/60/60/24+"天");


    }
}
